<template>
  <div>
    <Table
      :height="height"
      :border="border"
      @on-sort-change="onSortChange"
      @on-selection-change="selection"
      ref="comTable"
      :loading="loading"
      :data="data"
      :columns="columns"
    ></Table>
    <div class="pager">
      <Page
        @on-change="change"
        :current="current"
        :page-size="pageSize"
        :total="total"
        :show-total="showTotal"
        :show-elevator="showElevator"
      />
    </div>
  </div>
</template>
<style  scoped>
.pager {
  float: right;
  margin-top: 15px;
}
</style>
<script>
export default {
  props: {
    height: {
      type: Number
    },
    current: {
      type: Number,
      default: 1
    },
    data: {
      type: Array,
      default: []
    },
    columns: {
      type: Array,
      default: []
    },
    change: {
      type: Function,
      default: () => {

      }
    },
    pageSize: {
      type: Number,
    },
    total: {
      type: Number,
      default: 0
    },
    showTotal: {
      type: Boolean,
      default: true
    },
    showElevator: {
      type: Boolean,
      default: true
    },
    loading: {
      type: Boolean,
      default: false,
    },
    border: {
      type: Boolean,
      default: false,
    }
  },
  data () {
    return {
    }
  },
  mounted () {

  },
  methods: {
    selectAll (e) {
      this.$refs.comTable.selectAll(e);
    },
    selection (data) {
      this.$emit('getSelection', data);
    },
    onSortChange (data) {
      this.$emit('onSortChange', data);
    }
  }
}
</script>
